<script setup lang="ts">
const props = defineProps<{
  isCollapse: boolean
}>()

const emits = defineEmits(['update:isCollapse'])

function toggle() {
  emits('update:isCollapse', !props.isCollapse)
}

</script>

<template>
  <el-header class="header">
    <span @click="toggle">
      <el-icon-expand v-if="isCollapse"></el-icon-expand>
      <el-icon-fold v-else></el-icon-fold>
    </span>
    <h3>二次封装 element-plus 组件</h3>
  </el-header>
</template>

<style lang="scss" scoped>
span {
  cursor: pointer;
}

.header {
  display: flex;
  align-items: center;
  background-color: #fff;
  
  svg {
    width: 20px;
    height: 20px;
  }

  h3 {
    flex: 1;
    text-align: center;
    font-weight: 400;
  }
}
</style>
